<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--      &lt;!&ndash;部门数据&ndash;&gt;
            <el-col :span="4" :xs="24">
              <div class="head-container">
                <el-input
                  v-model="deptName"
                  placeholder="请输入部门名称"
                  clearable
                  size="small"
                  prefix-icon="el-icon-search"
                  style="margin-bottom: 20px"
                />
              </div>
              <div class="head-container">
                <el-tree
                  :data="deptOptions"
                  :props="defaultProps"
                  :expand-on-click-node="false"
                  :filter-node-method="filterNode"
                  ref="tree"
                  default-expand-all
                  @node-click="handleNodeClick"
                />
              </div>
            </el-col>-->
      <!--用户数据-->
      <el-col :span="24" :xs="24">
        <div style="margin: 15px auto;font-size: 30px;">当前统计</div>
        <el-row :gutter="20">
          <el-col :span="6"><div class="grid-content bg-purple"><p class="p1">发稿统计</p><p class="p2">{{count[0].count}}</p></div></el-col>
          <el-col :span="6"><div class="grid-content bg-purple"><p class="p1">待发布</p><p class="p2">{{count[1].count}}</p></div></el-col>
          <el-col :span="6"><div class="grid-content bg-purple"><p class="p1">待审核</p><p class="p2">{{count[2].count}}</p></div></el-col>
          <el-col :span="6"><div class="grid-content bg-purple"><p class="p1">已删除</p><p class="p2">{{count[3].count}}</p></div></el-col>
        </el-row>
      </el-col>
      <el-col :span="20" :xs="24" style="width: 100%;">
        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
          <el-form-item label="时间筛选">
            <el-date-picker
              v-model="dateRange"
              size="small"
              style="width: 240px"
              value-format="yyyy-MM-dd"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            ></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['monitor:dispatch:query']">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="list" >
          <el-table-column label="日期" align="center" key="time" prop="time"  />
          <el-table-column label="发稿增加" align="center" key="count" prop="count"  />
          <el-table-column label="文档修改" align="center" key="update_count" prop="update_count"  />
          <el-table-column label="文档删除" align="center" key="del_count" prop="del_count"  />

        </el-table>

        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
      </el-col>
    </el-row>



  </div>
</template>

<script>


  import { listFile , getFile , addFile , updateFile ,delFile ,fileCount} from "@/api/monitor/file";
  import { getToken } from "@/utils/auth";
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  export default {
    name: "File",
    components: { Treeselect },
    data() {
      return {
        user: {},
        sexs: [],

        id_card_type: [],
        status:[],
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 用户表格数据
        list: null,
        // 弹出层标题
        title: "",
        // 部门树选项
        deptOptions: undefined,
        // 是否显示弹出层
        open: false,
        // 部门名称
        deptName: undefined,
        // 默认密码
        initPassword: undefined,
        // 日期范围
        dateRange: [],
        // 状态数据字典
        statusOptions: [],
        // 性别状态字典
        Options: [],
        // 岗位选项
        postOptions: [],
        // 角色选项
        roleOptions: [],
        // 表单参数
        form: {},
        count:undefined,
        defaultProps: {
          children: "children",
          label: "label"
        },
        // 用户导入参数
        upload: {
          // 是否显示弹出层（用户导入）
          open: false,
          // 弹出层标题（用户导入）
          title: "",
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的用户数据
          updateSupport: 0,

        },
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          name: undefined,
          status: undefined
        },
/*        // 表单校验
        rules: {
          userName: [
            { required: true, message: "用户名称不能为空", trigger: "blur" }
          ],
          nickName: [
            { required: true, message: "用户昵称不能为空", trigger: "blur" }
          ],

          email: [
            {
              type: "email",
              message: "'请输入正确的邮箱地址",
              trigger: ["blur", "change"]
            }
          ],
          phonenumber: [
            {
              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
              message: "请输入正确的手机号码",
              trigger: "blur"
            }
          ]
        }*/
      };
    },
    created() {
      this.getList();

      /*this.getDicts("sys_normal_disable").then(response => {
        this.statusOptions = response.data;
      });
      this.getDicts("sys_user_sex").then(response => {
        this.sexOptions = response.data;
      });
      this.getConfigKey("sys.user.initPassword").then(response => {
        this.initPassword = response.msg;
      });*/
    },

    methods: {
      /** 查询用户列表 */
      getList() {
        this.loading = true;
        fileCount(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
            this.list = response.data[1];
            this.count = response.data[0];
            this.loading = false;
          }
        );
      },


      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.page = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },




    }

  };
</script>
<style>
  .el-row {
    margin-bottom: 20px;
  &:last-child {
     margin-bottom: 0;
   }
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #afc1da;
  }
  .bg-purple {
    background: #f1f1f1;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    height:195px;
    display:flex;
    flex-direction: column;
    justify-content: center;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
  .p1{
    text-align: center;
    margin:0;
  }
  .p2{
    text-align: center;
    color: #1074d7;
    font-size: 50px;
    line-height: 0px;
  }
</style>
